#pragma once
//#include <string>
#include "..\dxstdafx.h"
#include "Asset.h"
#include "..\base\Engine.h"
#include "..\utils\Logger.h"

namespace ds {

class Texture : public Asset {

public:	
	// the public available objects
	LPDIRECT3DTEXTURE9 texture;
	D3DXIMAGE_INFO info;
	// the methods
	Texture(const char* handle,LPDIRECT3DTEXTURE9 texture,int width,int height);
	Texture(const char* handle);
	virtual ~Texture();	
	LPDIRECT3DTEXTURE9 getTexture();
	int getWidth();
	int getHeight();
	RECT getBounds();
	bool loadTexture(const char* fileName);
	bool loadTextureFromResource(LPCTSTR resourceID);
	bool loadTexture(const char* fileName,int width,int height);
	bool useWrap() { return wrap;}
	void setWrap(bool wrp) { wrap = wrp;}
	// methods for creating and manipulating a texture
	bool createTexture(int width,int height);
	bool createTexture(char* data,UINT size);
	void lock();
	void setColor(int x,int y,uchar r,uchar g,uchar b,uchar a);
	void setColor(int x,int y,int offset,uchar value);
	uchar getColor(int x,int y,int offset);
	Color getColor(int x,int y);
	void unlock();
private:
	D3DLOCKED_RECT lockedRect;
	bool wrap;
};
};
